package org.ghost.http.testkit.dto;

import org.ghost.http.testkit.common.errorcode.SystemErrorCodeEnum;

import java.io.Serializable;
import java.util.Objects;

public class ResponseVO implements Serializable {
    /**
     * 成功标识
     */
    private boolean success;
    /**
     * 错误信息
     */
    private String message;

    /**
     * 错误码
     */
    private String code;
    /**
     * 返回对象
     */
    private Object data;

    /**
     * 提示类型，，此处主要是用于前端统一处理提示标识
     */
    private String reminder;

    /**
     * 错误级别，，
     */
    private int errorLevel;


    public ResponseVO() {
    }


    public ResponseVO(String code, String message) {
        this.message = message;
        this.code = code;
        if (Objects.equals(SystemErrorCodeEnum.SUCCESS.getCode(), code)) {
            this.success = true;
        }
    }

    public ResponseVO(boolean success, String message, String code) {
        this.message = message;
        this.code = code;
        this.success = success;
    }


    public ResponseVO(String message, String code, Object data) {
        this(code, message);
        this.data = data;
    }


    public ResponseVO(boolean success, String message, String code, Object data) {
        this(success, message, code);
        this.data = data;
    }


    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public boolean getSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getReminder() {
        return reminder;
    }

    public void setReminder(String reminder) {
        this.reminder = reminder;
    }


    @Override
    public String toString() {
        return "ResponseVO{" +
                "success=" + success +
                ", message='" + message + '\'' +
                ", code=" + code +
                ", data=" + data +
                ", reminder='" + reminder + '\'' +
                ", errorLevel=" + errorLevel +
                '}';
    }
}
